package com.magic.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.magic.item.mapper.OrderMapper;
import com.magic.item.pojo.Order;
import com.magic.item.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lan.jianyuan
 * @create 2021-03-24-17:48
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Override
    public void updateOrder(Order order) {
        this.orderMapper.updateByPrimaryKey(order);
    }
    
    @Override
    public PageInfo<Order> getPageInfo(String keyword, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Order> orders = orderMapper.selectExample(keyword);
        return new PageInfo<>(orders);
    }
    
    @Override
    public List<Order> queryOrderById(Long uid) {
        return this.orderMapper.selectOrderByOid(uid);
    }
}
